<div class="div-header">
	<div class="container-fluid">
		<div class="header-title">主控后台管理系统</div>
		<ul class="nav navbar-nav navbar-right">
			<li class="dropdown">
				<a href="javascript:void(0);" class="dropdown-toggle" style="padding: 6px 15px; line-height: 18px;">
					<span class="glyphicon glyphicon-user"></span>
					欢迎您：${loginForm.masterUser.name}
				</a>
				<div class="dropdown-menu dropdown-user" style="border: 0; background: none; box-shadow: none; -webkit-box-shadow: none;">
					<div class="pop-dropdown-apps user-tk">
						<div class="pda_arr"></div>
						<dl class="pda-list user_pda">
							<img src="/static/template/picture/morentouxiang.jpg">
							<div class="userright-list">
								<h1>管理员&nbsp;&nbsp;|&nbsp;&nbsp;${loginForm.masterUser.username}</h1>
								<h2>
									<b>数字账号：</b>${loginForm.masterUser.numberKey} <br>
									<!-- <b>角&nbsp; &nbsp;色：</b> -->
								</h2>
							</div>
							<div class="clear"></div>
							<div class="select-themes">
								<ul>
									<li>
										<a data-theme="body-theme-1" class="theme_1_thumb active" href="javascript:;">
											<span class="glyphicon glyphicon-ok-sign"></span>
										</a>
									</li>
									<li>
										<a data-theme="body-theme-2" class="theme_2_thumb" href="javascript:;">
											<span class="glyphicon glyphicon-ok-sign"></span>
										</a>
									</li>
									<li>
										<a data-theme="body-theme-3" class="theme_3_thumb" href="javascript:;">
											<span class="glyphicon glyphicon-ok-sign"></span>
										</a>
									</li>
									<li>
										<a data-theme="body-theme-4" class="theme_4_thumb" href="javascript:;">
											<span class="glyphicon glyphicon-ok-sign"></span>
										</a>
									</li>
									<li>
										<a data-theme="body-theme-5" class="theme_5_thumb" href="javascript:;">
											<span class="glyphicon glyphicon-ok-sign"></span>
										</a>
									</li>
									<li>
										<a data-theme="body-theme-6" class="theme_6_thumb" href="javascript:;">
											<span class="glyphicon glyphicon-ok-sign"></span>
										</a>
									</li>
									<li>
										<a data-theme="body-theme-7" class="theme_7_thumb" href="javascript:;">
											<span class="glyphicon glyphicon-ok-sign"></span>
										</a>
									</li>
									<!--<li>
								<a data-theme="body-theme-8" class="theme_8_thumb" href="javascript:;"><span class="glyphicon glyphicon-ok-sign"></span></a>
							</li>
							<li>
								<a data-theme="body-theme-9" class="theme_9_thumb" href="javascript:;"><span class="glyphicon glyphicon-ok-sign"></span></a>
							</li>
							<li>
								<a data-theme="body-theme-10" class="theme_10_thumb" href="javascript:;"><span class="glyphicon glyphicon-ok-sign"></span></a>
							</li>-->
								</ul>
							</div>
							<div class="userexit">
								<button id="btn_editorpassword" type="button" class="btn btn-info addbtm" style="padding-top: 4px;">
									<span class="glyphicon glyphicon-pencil"></span>
									修改密码
								</button>
								<button onclick="window.location.href='/login.html'" type="button" class="btn btn-default">退出登录</button>
							</div>
							<div class="clear"></div>
						</dl>
					</div>
				</div>
			</li>
		</ul>
	</div>
	<!-- container-fluid -->
	<div id="password-form" style="display: none;">
		<form action="" onsubmit="return false;">
			<input type="text" style="display: none" /> <input type="password" style="display: none" />
			<div class="append-loading">
				<div class="form-horizontal" style="padding-top: 24px;">
					<div class="form-group col-sm-12">
						<label class="fg-text control-label">旧密码</label>
						<div class="fg-input">
							<input type="password" autocomplete="new-password" name="oldpassword" class="form-control">
						</div>
					</div>
					<div class="form-group col-sm-12">
						<label class="fg-text control-label">新密码</label>
						<div class="fg-input">
							<input type="password" autocomplete="off" name="newpassword" class="form-control">
						</div>
					</div>
					<div class="form-group col-sm-12">
						<label class="fg-text control-label">重复新密码</label>
						<div class="fg-input">
							<input type="password" autocomplete="off" name="renewpassword" class="form-control">
						</div>
					</div>
				</div>
			</div>
		</form>
	</div>
</div>
<script>
	$(function() {
		$("#btn_editorpassword").click(function() {
			layer.ready(function() {
				layer.open({
					type : 1,
					title : '修改密码',
					skin : 'layui-layer-rim', // 加上边框
					area : [ '400px', '320px' ], // 宽高
					btn : [ '确定修改', '取消' ],
					content : $("#password-form").html(),
					success : function() {
						$(".layui-layer-content input[name='oldpassword']").val("");
						$(".layui-layer-content input[name='newpassword']").val("");
						$(".layui-layer-content input[name='renewpassword']").val("");
					},
					btn1 : function(index, layero) {
						var oldpassword = $.trim($(".layui-layer-content input[name='oldpassword']").val());
						var newpassword = $.trim($(".layui-layer-content input[name='newpassword']").val());
						var renewpassword = $.trim($(".layui-layer-content input[name='renewpassword']").val());
						if (oldpassword === '') {
							mylayer.error('旧密码密码不能为空！ ');
							return;
						}
						if (newpassword === '') {
							mylayer.error('新密码密码不能为空！ ');
							return;
						}
						if (renewpassword === '') {
							mylayer.error('重复新密码密码不能为空！ ');
							return;
						}
						if (newpassword.length < 4) {
							mylayer.error('新密码不能小于4个字符！ ');
							return;
						}
						if (newpassword.length > 32) {
							mylayer.error('新密码不能超过32个字符！ ');
							return;
						}
						if (newpassword !== renewpassword) {
							mylayer.error('两次新密码不一致！ ');
							return;
						}
						if ($(".layui-layer-content .mloading").hasClass("active")) {
							return;
						}
						$(".layui-layer-content").mLoading('show');
						request.post('/backend/mastermanage/userlist/update-user-password', {
							oldPassword : oldpassword,
							newPassword : newpassword
						}, function(response, data) {
							if (data && data.id) {
								layer.close(index);
							}
						}, null, function() {
							$(".layui-layer-content").mLoading('hide');
						});
					}
				});
			});
		});
	});
</script>